// 按需引入element ui的相关组件
import { 
    ElButton
    , ElSelect 
    , ElContainer
    , ElAside
    , ElMain
    , ElHeader
    , ElScrollbar
    , ElMenu
    , ElSubmenu
    , ElMenuItem
    , ElAvatar
    , ElDropdown
    , ElDropdownItem
    , ElDropdownMenu
    , ElTabPane
    , ElTabs

    , ElInfiniteScroll
    , ElLoading
    , ElMessage
    , ElMessageBox
    , ElNotification
} from 'element-plus';
import { App } from '@vue/runtime-core';

// 需要引入的组件，组件可以再自行添加
const components = [
    ElButton
    , ElSelect 
    , ElContainer
    , ElAside
    , ElMain
    , ElHeader
    , ElScrollbar
    , ElMenu
    , ElMenuItem
    , ElSubmenu
    , ElAvatar
    , ElDropdown
    , ElDropdownItem
    , ElDropdownMenu
    , ElTabPane
    , ElTabs
]

// 需要引入的插件
const plugins: any[] = [
    ElInfiniteScroll
    , ElLoading
    , ElMessage
    , ElMessageBox
    , ElNotification
]

export default function(app: App<Element>) {
    // 加载组件
    components.forEach(component => {
        app.component(component.name, component);
    });

    // 加载插件
    plugins.forEach(plugin => {
        app.use(plugin);
    });
}